<template>
	<view class="item" @click="toDetail">
		<view class="image-box">
			<image class="image" :src="$urlPrefix+goods.mainImages[0]"></image>
		</view>
		<view class="content">
			<view class="title">{{goods.title}}</view>
			<view class="bottom">
				<text>¥</text>
				<text style="font-size: 32rpx;color: red;">{{goods.price}}</text>
				<text style="margin-left: 10rpx;">{{goods.shipping_address}}</text>
				<text style="margin-left: 10rpx;">{{shipping_price}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"goods-card-full",
		props:{
			goods:{
				type:Object
			}
		},
		created() {
			(this.goods.shipping_price == 0) ? this.shipping_price="包邮":this.shipping_price = this.goods.shipping_price
		},
		data() {
			return {
				shipping_price:""
			};
		},
		methods:{
			toDetail(){
				uni.navigateTo({
					url:"/pages/goods-detail/goods-detail?id="+this.goods.id
				})
			}
		}
	}
</script>

<style lang="scss">
	.item {
		height: 250rpx;
		width: 100%;
		//border: 2rpx red solid;
		display: flex;
		flex-direction: row;
		padding: 10rpx;
		margin-top: 10rpx;
		box-shadow: 0 5rpx 5rpx #c3c3c3;
		.image-box{
			width: 33.3%;
			height: 250rpx;
			.image {
				width: 100%;
				height: 100%;
			}
		}
		
		.content {
			//border: 1rpx red solid;
			display: flex;
			flex-direction: column;
			width: 66.6%;
			margin: 0 10rpx;
			position: relative;
			.title{
				width: 100%;
				-webkit-line-clamp: 2;
				font-size: 32rpx;
				-webkit-box-orient: vertical;
				text-overflow: ellipsis;
				overflow: hidden;
				display: -webkit-box;
			}
			.bottom{
				position: absolute;
				bottom: 0rpx;
				left: 0rpx;
				text{
					font-size: 26rpx;
					color: #888888;
				}
			}
		}
	}
</style>
